#include<stdio.h>
#include <stdlib.h>
int main(){
	int days;
	int first;
	int start;//¶}©l¤é´Á«e­±ªºªÅ®æ 
	
	printf("Enter first date: ");
	scanf("%d",&first);
	printf("Enter days: ");
	scanf("%d", &days);
	
	printf("SUN MON TUS WED THU FRI SAI\n");
	
   	
	if(first<7)
    {       
            start=3*first+first+2;
            while(start>0)
            {
                printf(" ");
                start--;
            }
    }
    else if(first==4)
    {
        printf("-----");     
    }
	
	for(int i=1;i<=days;i++)
    {
        if(i<9)
        {
                if((first+i)%7==0)
                {
                   printf("%d\n",i);
                   printf("  ");
                 
                }
                else
                {
                    printf("%d",i);
                    printf("   ");
            
                }
        }
        
        else if(i>=9)    
        {
             if((first+i)%7==0)
             {
                    printf("%d\n",i);
                    printf(" ");
             }
             else
             {
                 printf("%d",i);
                 printf("  ");
             }
         }
    }
    printf("\n");
	printf("---------------------------\n");
	
	system("pause");
	return 0;
}
